package com.relytosoft.mizar.media.display.api.pojo.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.relytosoft.dubhe.common.core.utils.BeanCopyUtils;
import com.relytosoft.mizar.media.display.api.entity.ViewDetail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 视图明细数据传输类
 *
 * @author hj
 * @version 1.0
 * @date 2022/4/27 9:31
 * @ClassName ViewDetailDto
 */
@ApiModel("视图明细")
public class ViewDetailDto implements Serializable {

    private static final long serialVersionUID = 6151760233732648045L;
    /**
     * 通道ID
     */
    @ApiModelProperty(value = "通道ID")
    private Integer channelId;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序", required = true)
    @NotNull(message = "排序不能为空")
    private Integer sort;

    public Integer getChannelId() {
        return channelId;
    }

    public void setChannelId(Integer channelId) {
        this.channelId = channelId;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public ViewDetail buildViewDetail(Integer formId){
        ViewDetail viewDetail = new ViewDetail();
        viewDetail.setFormId(formId);
        viewDetail.setSort(this.sort);
        viewDetail.setChannelId(this.channelId);
        return viewDetail;
    }

    public static ViewDetailDto buildDto(ViewDetail viewDetail){
        ViewDetailDto dto = new ViewDetailDto();
        BeanCopyUtils.copy(viewDetail,dto);
        return dto;
    }
}

